package com.treemanage.treemanageback.mapper;

import com.treemanage.treemanageback.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

/**
 * 占位文件
 */
@Mapper
public interface LoginMapper {

    /**
     * 根据用户名查询用户
     * @param name  用户名
     * @return  用户对象
     */
    @Select("select * from user_back where username = #{name}")
    User findByName(String name);

    /**
     * 添加用户
     */
    @Insert("insert into user_back(name,passwd,email,phone,creat_time,update_time) values(#{name},#{passwd},#{email},#{phone},now(),now())")
    void add(String username, String password, String email, String phone);
}
